<?php

namespace App\Service\ServiceTrait;

use App\Cache\RedisKey;
use App\Constants\RecommendedGradeCode;
use App\Helpers\RedisUtil;
use App\Model\UserScore;

trait UpdateScoreTrait
{
    /**
     * 重置后台手动固定的数据(写入缓存列表池子)
     * @return void
     */
    public function resetFixUserData()
    {
        $fixUserId = UserScore::getManualDataByType();
        if (empty($fixUserId)){
            return;
        }

        $redis = RedisUtil::getRedis();

        foreach ($fixUserId as $one)
        {
            $redis->sAdd(RedisKey::todayUserGradeList(RecommendedGradeCode::GRADE_ARRAY[$one['type_id']]),$one['user_id']);
        }
    }
}